import React, {useEffect} from "react";
import {Spin} from "antd";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';

export const Loading = (props?: Record<string, any>): React.ReactNode => {
    return (
        <div className="w-full h-full flex justify-center items-center">
            <Spin size="large" {...props}/>
        </div>
    )
}
export const PageLoader = () => {
    useEffect(() => {
        NProgress.start();
        return () => {
            NProgress.done();
        };
    }, []);

    return <Loading/>;
};
